CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(Sample_sdk_c)

SET(CMAKE_BUILD_TYPE "Debug")
IF(WIN32)
ELSE()
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CFLAGS} -O0 -Wall -g2 -ggdb -L /lib64 -l pthread")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CFLAGS} -O3 -Wall")
ENDIF()

GET_FILENAME_COMPONENT(COMPILER_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
GET_FILENAME_COMPONENT(VC_DIR ${COMPILER_DIR} DIRECTORY)

SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" $ {CMAKE_MODULE_PATH})
SET(SRC_LIST main.c)

IF (APPLE) 
INCLUDE_DIRECTORIES( /usr/local/include/ )
SET(LIBRARYS_MY d/usr/local/lib/libqingstor.dylib)
ELSEIF(WIN32)
INCLUDE_DIRECTORIES(${VC_DIR}/include/) 
INCLUDE_DIRECTORIES( ../../include/)
SET(LIBRARYS_MY qingstor.lib) 
ELSE()
SET(LIBRARYS_MY /usr/local/lib/libqingstor.so) 
ENDIF()

ADD_EXECUTABLE(Sample_sdk_c ${SRC_LIST})
TARGET_LINK_LIBRARIES(Sample_sdk_c ${LIBRARYS_MY})

#If build with qingstor.a, the following content needs to be added
#SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../CMake" ${CMAKE_MODULE_PATH})
#FIND_PACKAGE(OpenSSL REQUIRED)
#FIND_PACKAGE(Curl REQUIRED)

#TARGET_LINK_LIBRARIES(Sample_sdk_cpp ${CURL_LIBRARIES})
#TARGET_LINK_LIBRARIES(Sample_sdk_cpp ${OPENSSL_SSL_LIBRARIES})
#TARGET_LINK_LIBRARIES(Sample_sdk_cpp ${OPENSSL_CRYPTO_LIBRARIES})
